using ShadeTree.Binding.Validation;
using Action=System.Action;

namespace ShadeTree.Binding
{
    public interface IBoundPart
    {
        IScreenBinder Binder { set; }
        string FieldName { get; }
        void Bind(object model);
        bool ApplyChanges();
        void Reset();
        void Update();
        void StopBinding();
        void SetDefaults();
    }

    public interface IBoundScreenElement : IScreenElement, IBoundPart
    {
        void RegisterChangeHandler(Action handler);

        void RememberLastChoice();
        void RebindAllOnChange();
        void RegisterLostFocusHandler(Action action);

        NotificationMessage[] Validate();
        bool IsDirty();

        object GetValue();
    }
}